namespace CloudNinja.Metering.Providers.Configuration.BlobBandwidth
{
    using System.Configuration;

    using CloudNinja.Metering.Common.Configuration;

    public class BlobBandwidthCollectionElement : ConfigurationElement
    {
        [ConfigurationProperty("Name", IsRequired = true, DefaultValue = "")]
        public string Name
        {
            get
            {
                return (string)this["Name"];
            }

            set
            {
                this["Name"] = value;
            }
        }

        [ConfigurationProperty("ConnectionString", IsRequired = true, DefaultValue = "")]
        public string ConnectionString
        {
            get
            {
                var currentValue = (string)this["ConnectionString"];

                return this.GetCurrentValueOrDefault(currentValue);
            }

            set
            {
                this["ConnectionString"] = value;
            }
        }

        [ConfigurationProperty("TenantIdPattern", IsRequired = false)]
        public string TenantIdPattern
        {
            get
            {
                var currentValue = (string)this["TenantIdPattern"];
                return this.GetDefaultTenantIdPattern(currentValue);
            }

            set
            {
                this["TenantIdPattern"] = value;
            }
        }
    }
}